<template>
	<view>
		<u-popup :round="10" :show="show" :safeAreaInsetBottom="false" mode="center">
			<view class="loginoutPop">
				<view class="title">{{title}}</view>
				<view class="desc">{{desc}}</view>
				<view class="loginoutBtn">
					<view class="btn confirm" @click="confirm">{{confirmText}}</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		name: "rf-downloadTips",
		props: {
			show: {
				type: Boolean,
				required: true,
				default: false,
			},
			title: {
				type: String,
				required: true,
				default: "下载链接"
			},
			desc: {
				type: String,
				required: true,
				default: ""
			},
			confirmText: {
				type: String,
				required: true,
				default: "复制链接"
			}
		},
		data() {
			return {
				confirmShow: false,
			};
		},
		watch: {
			show(val) {
				console.log("----=-=-=-=-");
				console.log(val);
			},

		},
		methods: {
			confirm() {
				this.$emit('confirm', true)
				let _that = this;
				wx.setClipboardData({
					//复制文本
					data: this.desc,
					success: function(res) {
						wx.showToast({
							title: '复制成功',
							icon: 'none',
							mask: 'true' //是否设置点击蒙版，防止点击穿透
						});
					}
				});
			},
		}
	}
</script>

<style lang="scss">
	.loginoutPop {
		width: 480rpx;
		height: 320rpx;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: space-around;
		font-size: 28rpx;
		z-index: 999;

		.title {
			font-size: 32rpx;
			font-weight: 600;
			margin-top: 20rpx;
		}

		.desc {
			color: #77798D;
			width: 360rpx;
			margin: 10rpx 40rpx;
			text-align: center;
			line-height: 35rpx;
			height: calc(3em + 3 * 0.5em);
			/* 计算两行高度（行高 × 行数 + 行间距） */
			overflow: hidden;
			text-overflow: ellipsis;
			word-break: break-word;
		}

		.loginoutBtn {
			display: flex;
			margin-bottom: 48rpx;

			.btn {

				width: 360rpx;
				height: 72rpx;
				color: #58C866;
				background: #FFFFFF;
				border-radius: 36rpx;
				border: 2rpx solid #58C866;
				text-align: center;
				line-height: 72rpx;
				margin: 0 10rpx;
			}

			.confirm {
				background-color: #58C866;
				color: #fff;
			}
		}
	}
</style>